package com.taobao.action.ui;

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;

import com.taobao.action.CommonAction;
import com.taobao.ui.widget.CommonWidget;

public class ButtonAction implements SelectionListener {

	private CommonAction action;

	private CommonWidget commonWidget;

	private Object sourceObject;

	public ButtonAction(CommonAction action, CommonWidget commonWidget, Object sourceObject) {
		this.action = action;
		this.commonWidget = commonWidget;
		this.sourceObject = sourceObject;
	}

	@Override
	public void widgetDefaultSelected(SelectionEvent arg0) {
	}

	@Override
	public void widgetSelected(SelectionEvent arg0) {
		action.setData("source", sourceObject);
		action.doAction(commonWidget);
	}

}
